<?php
Route::get('/', function(){
	if(Auth::check())
		return View::make('home');
	
	return View::make('public');
});

Route::get('/togglehelp', function(){
	$key = 'ui.help.hide';
	Session::set($key, !(bool)Session::get($key));
	return Redirect::back();
});

Route::group(
	[
		'namespace' => 'Netshell\Controllers',
		'before' => 'auth'
	],
	function(){
		Route::resource('projects', 'Project');
		Route::resource('projects.routes', 'ProjectRoutes');
		
		Route::resource('user', 'User');
	}
);

Route::controller('/auth', 'AuthController');
Route::get('/signout', function(){
	Auth::logout();
	return Redirect::back();
});